#include <iostream>
#include "vector"
#include "map"
#include <unordered_map>
#include <stack>
#include <math.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <queue>
#include <cctype>
using namespace std;
struct ListNode
{
    int val;
    ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};
struct TreeNode
{
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
class Node
{
public:
    int val;
    Node *left;
    Node *right;
    Node *next;

    Node() : val(0), left(NULL), right(NULL), next(NULL) {}

    Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}

    Node(int _val, Node *_left, Node *_right, Node *_next)
        : val(_val), left(_left), right(_right), next(_next) {}
};

class Solution
{
public:
    bool isNumber(string s)
    {
        //判断是否是数值
        //首先去除空格
        //去除前面的空格
        int index = 0;
        while (s[index] == ' ')
        {
            index++;
        }
        int flag = 0;     //符号
        int xiaoshu = 0;  //是否出现小数点.
        int ee = 0;       //是否出现e
        int zhengshu = 0; //之前数是否为整数
        //处理中间
        while (index < s.size())
        {
            if (ee == 1)
            {
                //如果后面出现小数直接false
                if (s[index] == '.')
                {
                    return false;
                }
            }
            //符号处理 如果出现e另外判断
            if (s[index] == '-' || s[index] == '+' && flag != 0)
            {
                flag = 1;
                zhengshu = 0;
                index++;
            }
            if (s[index] - '0' >= 0 && s[index] - '0' <= 9)
            {
                zhengshu = 1;
                index++;
            }
            if (s[index] == '.' && xiaoshu == 0)
            {
                //只能出现一个小数点
                xiaoshu = 1;
                index++;
            }
            if (s[index] == 'e' || s[index] == 'E' && ee == 0)
            {
                // e之前可以为整数或者小数 但之后必须为整数
                ee = 1;
                index++;
                xiaoshu = 0;
                zhengshu = 0;
                flag = 0; // e之后可以有符号
            }
        }
        if (ee == 1 && zhengshu != 1)
        {
            // e后面没有整数
            return false;
        }
        //处理空格
        while (index < s.size())
        {
            if (s[index] == ' ')
                index++;
            else
            {
                return false;
            }
        }
        return true;
    }
};

int main()
{
    Solution s;
    vector<int> bills = {5, 5, 10, 10, 20};
    cout << s.lemonadeChange(bills);
    return 0;
}